<?php
/**
 * 不在区间内的查询
*/

namespace houze\mongodb\query;

class notbetween {
    /**
     * 构造时间查询
    */
    public static function run($field, $where, $data) {
        $start = $data[0];
        $end = $data[1];

        if (!is_numeric($start)) $start = strtotime($start);
        if (!is_numeric($end)) $end = strtotime($end);
        
        return [
            [
                'field' => $field,
                'where' => '<',
                'value' => $start,
            ],
            [
                'field' => $field,
                'where' => '>',
                'value' => $end,
            ],
        ];
    }
}